package com.itheima.HOMEW;

public class Teacher {
  /*  请定义教师类（Teacher），属性包括姓名和工号。
    要求分别使用空参和有参构造方法创建对象，
    空参创建的对象通过setXxx赋值，有参创建的对象直接赋值。
    定义教课（teach）方法，输出“工号为xxx的xxx老师正在讲课”。
    */
  private String name;
  private  int num;

  public Teacher(){

  }
  public  Teacher(String name , int num){
      this.name = name;
      this.num = num;
  }

    public void setName(String name) {
        this.name = name;
    }

    public int getName() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getNum() {
        return num;
    }
    public void teacher(){
        System.out.println("工号为"+num+"的"+name+"老师正在讲课");
    }
}
class Teacherdemo{
    public static void main(String[] args) {
        Teacher t1 = new Teacher();
        t1.setName("李辉");
        t1.setNum(1);
        t1.teacher();

        Teacher t2 = new Teacher("黄桂林",2);
        t2.teacher();
    }
}

